﻿package{
	
	
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.display.SimpleButton;
	import flash.media.Sound;
	
	public class GUI_SoundButton extends MovieClip{
		
		
		public static var isSoundOn:Boolean = true;
		
		
		public function GUI_SoundButton(){
			
			addEventListener(MouseEvent.MOUSE_DOWN, onClick);
			
			updateSymbol();
			
		}
		
		private function onClick(e:MouseEvent){
			//사운드 켜/꺼 이벤트 디스페치
			
			trace("on click called");
			
			
			isSoundOn = !isSoundOn;
			
			Clickr.toggleSound(isSoundOn);
			
			
			if (isSoundOn) {
				trace("사운드 켜");
			}else {
				trace("사운드 꺼");
			}
			
			updateSymbol();
			
		}
		
		private function updateSymbol() {
			trace("isSoundOn", isSoundOn);
			On.visible = isSoundOn;
			Off.visible = !isSoundOn;
			
		}
		
		
	}
	
	
	
	
}